package com.bite.blog.config;

import com.bite.blog.model.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
@ControllerAdvice
@ResponseBody
public class ErrorHandler {
    @ExceptionHandler
    public Result handler(Exception e){
        return Result.fail(e.getMessage());
    }
}